package com.normal.main.activity

import android.os.Bundle
import android.view.View
import com.didi.drouter.annotation.Router
import com.normal.main.R
import com.normal.main.databinding.ActivityMainBinding
import com.normal.zbase.impl.arouter.DRouterPath
import com.normal.zbase.impl.arouter.DRouterUtils
import com.normal.zbase.impl.base.BaseActivity
import com.normal.zbase.impl.event.EventBean
import com.normal.zbase.impl.event.EventUtils
import com.normal.zbase.impl.tools.extend.logger

@Router(path = DRouterPath.Path.APP_MAIN)
class MainActivity : BaseActivity<ActivityMainBinding>() {
    override fun viewBinding(): ActivityMainBinding {
        return ActivityMainBinding.inflate(layoutInflater)
    }

    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)
        EventUtils.subscriber(EventBean.TYPE_1, lifecycle) {
            viewBinding.btnMvvm.text = "收到请求1"
            logger.info("收到请求1")
        }

    }

    fun onClickView(view: View) {
        when (view.id) {
            //MVVM
            R.id.btn_mvvm ->
                DRouterUtils.startAct(DRouterPath.Path.APP_MVVM)
            //navigation
            R.id.btn_navigation_login -> DRouterUtils.startAct(DRouterPath.Path.APP_Navigation)

            R.id.btn_room -> DRouterUtils.startAct(DRouterPath.Path.APP_ROOM)


        }
    }
}